<div class="wrap">

{if $product_message != null}
	<div id="ajaxResponse1" class="ajaxResponse fade" style="display:block">{$product_message}</div>
{else}
	<div id="ajaxResponse1" class="ajaxResponse"></div>
{/if}
<h2>{TranslateTag}B_LABEL_EDIT_PRODUCT{/TranslateTag}</h2>
<form name="editproduct" id="editproduct" enctype="multipart/form-data" method="post">
	<input type="hidden" name="act" value="editproduct" />
    {if $smarty.get.submod}
    <input type="hidden" name="url" value="?module={$smarty.get.module}&sub1={$smarty.get.sub1}&submod={$smarty.get.submod}&groupid={$smarty.get.groupid}" />
    {else}
    	<input type="hidden" name="url" value="?module={$smarty.get.module}&sub1={$smarty.get.sub1}" />	
    {/if}
	<input type="hidden" name="product_id" value="{$smarty.get.id}" />
    <input type="hidden" name="total_photos" id="total_photos" value="3" />
	<table class="adminform left" width="70%" cellspacing="2" cellpadding="5">
		<tr>
			<th scope="row" valign="top">
			{TranslateTag}B_LABEL_PRODUCT_GROUP{/TranslateTag}:</th>
			<td>        
	  			<select name='product_group_id' id='product_group_id' class='postform'>
		  			{foreach name=cat from=$PRODUCTLIST item=item}
						<option value='{$item->product_group_id}' {if $PRODUCT->product_group_id eq $item->product_group_id}selected{/if}>
						{$item->product_group_name}
					</option>
					{/foreach}
				</select>
	  		</td>
		</tr>
		<tr>
			<th scope="row" valign="top">
			<label for="product_status">Status:</label></th>
			<td>
				{if $PRODUCT->status == "normal"}
	  				{assign var="isNormal" value="selected"}
	  			{else}
	  				{assign var="isNew" value="selected"}
	  			{/if}
	  			<select name='status' id='status' class='postform'>
					<option {$isNormal} value='normal'>Normal</option>
					<option {$isNew} value='new'>New</option>
				</select>
	  		</td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			{TranslateTag}B_LABEL_PRODUCT_NAME{/TranslateTag}:</th>
			<td width="67%">
			<input name="product_name" id="product_name" type="text" value="{$PRODUCT->product_name}" size="50" /></td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			{TranslateTag}B_LABEL_THUMBNAIL{/TranslateTag}:</th>
			<td width="67%">
			<input type="file" name="product_thumbnail" style="width:99%"/>
            </td>
		</tr>
        <tr>
			<th width="33%" scope="row" valign="top">
			</th>
			<td width="67%">
			<img src="{$PATH}{$PRODUCT->product_thumbnail}" />
            </td>
		</tr>
        <tbody id="product_photos">
        <tr>
			<th width="33%" scope="row" valign="top">
			Image 1:</th>
			<td width="67%">
			<input type="file" name="product_image_1" />
            </td>
		</tr>
        <tr>
			<th width="33%" scope="row" valign="top">
			Image 2:</th>
			<td width="67%">
			<input type="file" name="product_image_2" />
            </td>
		</tr>
        <tr>
			<th width="33%" scope="row" valign="top">
			Image 3:</th>
			<td width="67%">
			<input type="file" name="product_image_3" />
            </td>
		</tr>
        </tbody>
        <tr>
			<th width="33%" scope="row" valign="top">
			</th>
			<td width="67%">
			<a href="javascript: void(0)" onclick="onAddProductPhotos('product_photos','total_photos');">Add images</a>
            </td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			{TranslateTag}B_LABEL_PRICE{/TranslateTag}:</th>
			<td width="67%">
			<input name="product_price" id="product_price" type="text" value="{$PRODUCT->product_price}" size="20" /></td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			{TranslateTag}B_LABEL_CURRENCY{/TranslateTag}:</th>
			<td>   
            	<select name='currency_id' id='currency_id' class='postform'>
		  			{foreach name=currency from=$CURRENCY item=item}
						<option id='{$item->currency_id}' {if $PRODUCT->currency_id eq $item->currency_id}selected{/if} value='{$item->currency_id}'>
						{$item->code}
					</option>
					{/foreach}
				</select>     
	  			
	  		</td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			{TranslateTag}B_LABEL_TAX{/TranslateTag} (%):</th>
			<td width="67%">
			<input name="tax" id="tax" type="text" value="{$PRODUCT->tax}" size="10" /></td>
		</tr>
		<tr>
			<th width="33%" scope="row" valign="top">
			Transit days:</th>
			<td width="67%">
			<input name="transitdays" id="transitdays" type="text" value="{$PRODUCT->transitdays}" size="10" /></td>
		</tr>
		<tr>
			<th scope="row" valign="top">
			{TranslateTag}B_LABEL_DESCRIPTION{/TranslateTag}:</th>
			<td><textarea name="product_description" id="product_description" rows="5" cols="50" style="width: 97%;">{$PRODUCT->product_description}</textarea></td>
		</tr>
	</table>
    <div class="frame_photos_product" style="margin-left:72%">
    	{foreach name=photos from=$PHOTOS item=item}
        	<div class="photos_one left" id="photos_one_{$item->id}">
            	<img src="{$PATH}{$item->product_photo}"/>
                <div class="frame_del_photos">
                	<a href="javascript: void(0)" onclick="onDeletePhotos('?{$smarty.server.QUERY_STRING}', '{$item->id}', '{$item->product_photo}', 'ajaxResponse1')" >
                    	<img src="../view/admin/images/object_delete.png" alt="Delete" />	
                    </a>    
                </div>
            </div>	
        {/foreach}
        <div class="clear"></div>
    </div>
    <div class="clear"></div>
	<p class="submit" align = "right">
		<input type="image" name="submit" src="../view/admin/images/object_save.png" value="" />
	</p>
</form>

</div>